package com.wc.alorithm_luogu.P1249;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/26 22:28
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        if (n == 3) {
            System.out.println(1 + " " + 2);
            System.out.println(2);
        }
        if (n == 4) {
            System.out.println(1 + " " + 3);
            System.out.println(3);
            return;
        }
        int num = 2;
        int sum = 2;
        ArrayList<Integer> ans = new ArrayList<>();
        while (sum < n) {
            ans.add(num);
            num++;
            sum += num;
        }
        if (n == sum) {
            ans.add(num);
        }
        // 最后剩下数怎么办，给从大到小的每一个数都加上1
        if (n < sum) {
            int size = ans.size();
            int lastNum = n - (sum - num);
            for (int i = size - 1; lastNum > 0; i--) {
                if (i == -1) {
                    i = size - 1;
                }
                ans.set(i, ans.get(i) + 1);
                lastNum--;
            }
        }
        BigDecimal bigDecimal = new BigDecimal(ans.get(0));
        StringBuilder str = new StringBuilder();
        str.append(ans.get(0));
        int size = ans.size();
        for (int i = 1; i < size; i++) {
            bigDecimal = bigDecimal.multiply(BigDecimal.valueOf(ans.get(i)));
            str.append(' ');
            str.append(ans.get(i));
        }

        System.out.println(str);
        System.out.println(bigDecimal);
    }
}
